package org.example.util;

import javax.swing.*;
import java.awt.*;

/**
 * @ClassName: ImagePanel
 * @Description:
 * @Author: zkd
 * @Date: 2024/3/20 17:15
 * @Version: 1.0
 **/
public class ImagePanel extends JPanel {

    private final byte[] bytes;

    public ImagePanel (byte[] bytes) {
        this.bytes = bytes;
    }

    public void paint(Graphics g) {
        super.paint(g);
        ImageIcon icon = new ImageIcon(bytes);
        g.drawImage(icon.getImage(), 0, 0, 400, 300, this);
    }
}
